package com.atguigu.userprofile.dao;

import com.atguigu.userprofile.bean.TagInfo;
import com.atguigu.userprofile.utils.MySQLUtil;

import java.util.List;

public class TagInfoDAO {
    public static TagInfo getTagInfoWithTaskId(String taskId) {
        String querySQL = "SELECT * FROM tag_info WHERE tag_task_id =" + taskId;
        TagInfo tagInfo = MySQLUtil.queryOne(querySQL, TagInfo.class, true);
        return tagInfo;
    }

    //获取所有已启用的标签
    public static List<TagInfo> getTagInfoWithOn(){
        String querySQL = "SELECT * FROM task_info \n" +
                "JOIN tag_info\n" +
                "ON task_info.`id`=tag_info.`tag_task_id`\n" +
                "WHERE task_status = 1";
        List<TagInfo> tagInfoList = MySQLUtil.queryList(querySQL, TagInfo.class, true);
        return tagInfoList;
    }
}
